export class PrintInstruction {
	/**
	 * 初始化打印机，重置打印机所有状态
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static INIT = [27, 64];

	/**
	 * 获取打印机状态
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_v = [27, 118, 1];

	/**
	 * 打印缓存区并换行
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static LF = [10];

	/**
	 * 打印缓存区并走纸 n 点行
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_J = [27, 74];

	/**
	 * 打印缓存区并走纸 n 行
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_d_n = [27, 100];

	/**
	 * 设置行间距为 32 点
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_2 = [27, 50];

	/**
	 * 设置行间距为 n 点行
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_3_n = [27, 51];


	/**
	 * 设置打印为左对齐
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_a_0 = [27, 97, 0];

	/**
	 * 设置打印为居中对齐
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_a_1 = [27, 97, 1];

	/**
	 * 设置打印为右对齐
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_a_2 = [27, 97, 2];

	/**
	 * 设置打印字体格式
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static FORMAT = [27, 33];

	/**
	 * 设置打印字间距
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static ESC_SP_n = [27, 32];

	/**
	 * 设置打印条形码高度
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static GS_h_n = [29, 104];

	/**
	 * 设置打印二维码大小
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static QRCODE_SIZE = [29, 40, 107, 3, 0, 49, 67];

	/**
	 * 设置打印二维码大小
	 *
	 * @static
	 * @memberof PrintInstruction
	 */
	static QRCODE = [29, 40, 107, 3, 0, 49, 80, 48];

}

export type TemplateItemConfig = {
	type: "text" | "barcode" | "qrcode" | "feed",
	label: string,
	lines?: number,
	align?: "left" | "center" | "right",
	bold?: boolean,
	doubleWidth?: boolean,
	doubleHeight?: boolean,
	qrcodeSize?: number,
	barcodeSize?: number,
	value?: string
}

export type TemplateConfig = {
	name: string,
	configs: TemplateItemConfig[]
}
